
var path = require('path')
//为html文件中引入的外部资源如script、link动态添加每次compile后的hash，防止引用缓存的外部文件问题
var HtmlWebpackPlugin  = require('html-webpack-plugin')

module.exports = {
	 entry:path.join(__dirname,'./src/main.js'),
    output:{
      path:path.join(__dirname,'./dist'),
      filename:'bundle.js'
    } ,
    mode:"development",
    plugins:[
       new HtmlWebpackPlugin({
       	 template:'./src/views/index.html',
       	 filename:'index.html'
       })
    ],
    module:{
    	rules:[
          {test:/\.css$/,use:['style-loader','css-loader']},
          {test:/\.(jpg|png)$/,use:'url-loader?limit=3000&name=[hash:8]-[name].[ext]'},
          {test:/\.(ttf|svg|woff|woff2||eot)$/,use:'url-loader'},
          {test:/\.js$/,use:'babel-loader',exclude:/node_modules/}//转换es6高级语法
    	]
    }
}